﻿@using Webdiyer.WebControls.Mvc
@model PagedList<NationalIT.PayrollProcessingLog>
<h3>
    Processing Payroll log</h3>
<div class="f_req">@ViewBag.Error</div>
<div class="row-fluid">
    <div class="span12">
        <div class="row-fluid">
            <div class="span12">
                @if ((bool)ViewBag.ShowButtonDelete)
                {
                    @Html.ActionLink("Delete", "Delete", null, new { @class = "btn btn-danger DeleteItem confirmDelete" })
                }
            </div>
        </div>
        <table class="table">
            <tr>
                <th>
                    <input type="checkbox" name="" value="" class="checkAll" />
                </th>
                <th>
                    Payroll amount
                </th>
                <th>
                    Driver name
                </th>
                <th>
                    User perform
                </th>
                <th>
                    Action
                </th>
                <th>
                    Date
                </th>
            </tr>
            @foreach (var item in Model)
            {
                <tr>
                    <td>
                        <input type="checkbox" name="checkOwner" value="@item.ID" class="checkitem"/>
                    </td>
                    <td>
                        @if (!item.Deleted)
                        {
                            @Html.ActionLink(String.Format("{0:C}", item.PayrollAmount) + "", "PayrollsRollBack", "DriverInfo",new { id = item.TempReportID, driverID = item.DriverID },null)
                        }
                        else
                        {
                            @(String.Format("{0:C}", item.PayrollAmount))
                        }
                    </td>
                    <td>
                        @item.DriverName
                    </td>
                    <td>
                        @item.UserName
                    </td>
                    <td>
                        @if (item.Deleted)
                        {
                            <span class="error">@item.Action</span>
                        }
                        else
                        {
                            @(item.Action)
                        }
                    </td>
                    <td>
                        @item.Date.ToString("MM/dd/yyyy HH:mm")
                    </td>
                </tr>
            }
        </table>
        <div class="row-fluid">
            <div class="span4">
                <div class="dataTables_info">
                    @if (Model.TotalItemCount > 0)
                    {
                        if (Model.TotalItemCount < Model.PageSize)
                        {
                        <span>1 </span>
                        <span>- </span>@Model.TotalItemCount
                        }
                        else
                        {
                        <span></span>@((Model.CurrentPageIndex - 1) * Model.PageSize + 1)
                        <span>- </span>@((Model.CurrentPageIndex != Model.TotalPageCount) ? (Model.CurrentPageIndex * Model.PageSize) : Math.Abs((Model.CurrentPageIndex) * Model.PageSize - (Model.PageSize * Model.TotalPageCount) - Model.TotalItemCount))
                        }
                        <span>of </span>@(Model.TotalItemCount)                            
                    }
                </div>
            </div>
            <div class="span8">
                <div class="dataTables_paginate paging_bootstrap pagination phantrangmvcpager">
                    @Html.Pager(Model, new PagerOptions { ContainerTagName = "ul", PageIndexParameterName = "page", CurrentPagerItemWrapperFormatString = "<li class='active'>{0}</li>", CurrentPageNumberFormatString = "{0}", FirstPageText = "&laquo; ", LastPageText = " &raquo;", NextPageText = "Next →", PrevPageText = "← Prev", SeparatorHtml = "" })
                </div>
            </div>
        </div>
    </div>
</div>
